#ifndef FILTER_H
#define FILTER_H
#include "stm32f4xx.h"
#include "structconfig.h"

typedef struct
{
 float Input_Butter[3];
 float Output_Butter[3];
}Butter_BufferData;

typedef struct
{
  float a[3];
  float b[3];
}Butter_Parameter;

void yijiehubu_R(float angle_m, float gyro_m,float *angle_R);
void yijiehubu_HC(float angle_m, float gyro_m,float *angle_R);
void yijiehubu_Gry(float angle_m, float gyro_m,float *angle_R);
void yijiehubu_Acc(float angle_m, float gyro_m,float *angle_R);
void yijiehubu_VZ(float angle_m, float gyro_m,float *angle_R);
void erjiehubu_P(float angle_m, float gyro_m,float *angle_P);
void Hubu_Zuidatidu(float jifen,float jiaozhen,float *out);
void RC_Filter(float in,float *out);
void RC_Filter_Acc(float in,float *out);
void RC_Filter_SPL(float in,float *out);
void kalman_1(float in,float *out);
float ACC_LPF(float curr_input,Butter_BufferData *Buffer,Butter_Parameter *Parameter);
float GYRO_LPF(float curr_inputer,Butter_BufferData *Buffer, Butter_Parameter *Parameter);
float Low_Filter(float value);
void SortAver_Filter(float value,float *filter,uint8_t N);
void  SortAver_Filter1(float value,float *filter,uint8_t n);
void  SortAver_FilterXYZ(INT16_XYZ *acc,FLOAT_XYZ *Acc_filt,uint8_t N);
void Aver_FilterXYZ6(INT16_XYZ *acc,INT16_XYZ *gry,FLOAT_XYZ *Acc_filt,FLOAT_XYZ *Gry_filt,uint8_t N);
void Aver_FilterXYZ(INT16_XYZ *acc,FLOAT_XYZ *Acc_filt,uint8_t N);
void Aver_Filter(float data,float *filt_data,uint8_t n);
void Aver_Filter1(float data,float *filt_data,uint8_t n);
void presssureFilter(float* in, float* out);

void LPF2pSetCutoffFreq_1(float sample_freq, float cutoff_freq);
float LPF2pApply_1(float sample);



#endif
